derivation of Euler Lagrange equation